package com.hsp.Demo_03_object;

public class Demo_03 {
    public static void main(String[] args) {

//        int demo_a = 30;
//        int demo_b = 50;
//        BB bb = new BB();
//        bb.charge(demo_a, demo_b);
//        System.out.println("demo_a = " + demo_a + ", demo_b = " + demo_b);

        BB bb = new BB();
        int[] a = {0, 1, 2, 3};
        bb.charge2(a);
        System.out.println();
        System.out.println("=============");
        System.out.println("main方法中的数组打印：");
        for(int i = 0; i < a.length; i++){
            System.out.print(a[i] + " ");
        }
    }
}


class BB{

    public void charge(int a, int b){
        int temp = a;
        a = b;
        b = temp;
        System.out.println("a = " + a + ", b = " + b);
    }

    public void charge2(int[] a){
        System.out.println("charge2中的数组改变前打印:");
        for(int i = 0; i < a.length; i++){
            System.out.print(a[i] + " ");
        }
        System.out.println();
        a[0] = 3;
        System.out.println("charge2中的数组改变后打印:");
        for(int i = 0; i < a.length; i++){
            System.out.print(a[i] + " ");
        }
    }
}